package com.zxbg.controller.proportalController;

import com.zxbg.controller.Code;
import com.zxbg.controller.Result;
import com.zxbg.domain.App;
import com.zxbg.service.proportalService.AppCenterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
@RequestMapping("/appCenter")
public class AppCenterController {
    @Autowired
    AppCenterService appCenterService;

    @GetMapping
    public Result getAllApps(@RequestHeader Integer tenant_id) {
        return new Result(Code.GET_OK, appCenterService.getAllApps(tenant_id));
    }

    @PutMapping
    public Result updateApp(@RequestBody App app, @RequestHeader Integer tenant_id) {
        app.setTenant_id(tenant_id);
        return new Result(Code.UPDATE_OK, appCenterService.updateApp(app));
    }

    @GetMapping("/getActiveCategory")
    public Result getActiveCategory(@RequestHeader Integer tenant_id) {
        return new Result(Code.GET_OK, appCenterService.getActiveCategory(tenant_id));
    }
}
